#include ".\materialmng.h"

/*--------------------------------------------------------------------------------
	Func :
--------------------------------------------------------------------------------*/
BOOL CMaterialMng::AddMtl( Mtl* pMtl )
{
	if( !pMtl )
	{
		return FALSE;
	}

	int	nNumOfMtl	= mtlTab.Count();

	for( int i = 0 ; i < nNumOfMtl ; i++ )
	{
		if( mtlTab[i] == pMtl )
		{
			return FALSE;
		}
	}
	mtlTab.Append( 1 , &pMtl , 25 );

	return TRUE;
}

/*--------------------------------------------------------------------------------
	Func :
--------------------------------------------------------------------------------*/
int	CMaterialMng::GetMtlID( Mtl* pMtl )
{
	int nNumOfMtl = mtlTab.Count();

	for( int i = 0 ; i < nNumOfMtl ; i++ )
	{
		if( mtlTab[i] == pMtl )
		{
			return i;
		}
	}
	return -1;
}

/*--------------------------------------------------------------------------------
	Func : Mtl Release
--------------------------------------------------------------------------------*/
VOID	CMaterialMng::Release()
{
	mtlTab.Delete( 0 , mtlTab.Count() );
}